/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package HumanCentredSystemDesign;

import java.util.ArrayList;
import java.util.Date;

/**
 *
 * @author Martin
 */
public abstract class Item {
    
    protected String itemIdentifier;
    protected String title;
    protected String publisher;
    protected Date publicationDate;
    protected String type; //"Book" or "Periodical" -- should use enum
    
    
    public String getItemIdentifier(){
        return this.itemIdentifier;
    }
    
    public abstract String getAuthor();
    
    public void setItemIdentifier(String _id){
        this.itemIdentifier = _id;
    }
    public String getTitle(){
        return this.title;       
    }
    public String getPublisher(){
        return this.publisher;
    }
    public Date getPublicationDate(){
        return this.publicationDate; 
    }
    public String getType(){
        return this.type;
    }
       
    public void setTitle(String _title){
        this.title = _title;
    }
    public void setPublisher(String _publisher){
        this.publisher = _publisher;    
    }
    
    public void setPublicationDate(Date _publicationDate){
        this.publicationDate = _publicationDate;
    }
    public abstract boolean isReserved();
    
    public abstract Borrower getFirstReserver();
        
    public  ArrayList<Copy> getItemCopies(){
           
        ArrayList<Copy> listOfCopies = new ArrayList<Copy>();
        Connect myConn = new Connect();
        myConn.establishConnection();
        
        listOfCopies = myConn.getItemCopiesFromDatabase("%",this.itemIdentifier );
        myConn.closeConnection();
        return listOfCopies;
    
    }

}

